<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="${model.className}" table="${model.tableName}" >
		<comment>${model.displayName}</comment>
		<#list model.fields as field>
			<#if field.primaryKey?? && field.primaryKey=="1">
				<id name="${field.pojoField}" type="${field.type}" length="32">
					<column name="${field.tableColumn}" not-null="true"/>
					<generator class="com.tdqs.pnpms.sync.TdqsUUIDHexGenerator"/>
				</id>
			</#if>
		</#list>
		
		<#list model.fields as field>
			<#if field.primaryKey?? && field.primaryKey=="1">
			<#else>
				<#if field.entityModle?? && field.entityModle.className??>
					<#if field.entityModle.className=="com.tdqs.pnpms.config.pojo.BusinessInstance">
					<many-to-one name="${field.pojoField}" class="${field.type}" column="${field.tableColumn}" cascade="all" lazy="proxy"/>
					<#else>
					<many-to-one name="${field.pojoField}" class="${field.type}" column="${field.tableColumn}" cascade="none" lazy="proxy"/>
					</#if>
				<#else>
					<property name="${field.pojoField}" type="${field.type}">
						<column name="${field.tableColumn}">
							<comment>${field.displayName}</comment>
						</column>
					</property>
				</#if>
			</#if>
		</#list>
		
		<#if model.isExtendPojo?? && model.isExtendPojo=="1">
			<many-to-one name="businessProcess" class="com.tdqs.pnpms.config.pojo.BusinessProcess"
				column="PROCESS_ID" cascade="none" lazy="proxy" />
		</#if>	
		
	</class>
</hibernate-mapping>
